diff options
| author | Kit La Touche <kit@transneptune.net> | 2025-01-13 17:34:46 -0500 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2025-01-13 17:34:46 -0500 |
| commit | 55c6b6788f670cd7b2c96f6e8ae7bb2378b86176 (patch) | |
| tree | b4ad6208a72cdb0b83c6ff89ff61de20539dc777 /ui/routes/(app)/ch/[channel]/+page.svelte | |
| parent | 21c566479962cd7ecfa6dccd929b3069d0b201f9 (diff) | |
| parent | bdb7e677e2eaae1cc730915c79dd024c8acebdd3 (diff) | |
Merge branch 'main' into wip/fonts
Diffstat (limited to 'ui/routes/(app)/ch/[channel]/+page.svelte')
| -rw-r--r-- | ui/routes/(app)/ch/[channel]/+page.svelte | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ui/routes/(app)/ch/[channel]/+page.svelte b/ui/routes/(app)/ch/[channel]/+page.svelte index 8eba709..dbdb507 100644 --- a/ui/routes/(app)/ch/[channel]/+page.svelte +++ b/ui/routes/(app)/ch/[channel]/+page.svelte @@ -18,15 +18,17 @@ const elementTop = elRect.top; const elementBottom = elRect.bottom; - return ((parentTop < elementTop) && (parentBottom > elementBottom)); + return parentTop < elementTop && parentBottom > elementBottom; } function getLastVisibleMessage() { const parentElement = activeChannel; const childElements = parentElement.getElementsByClassName('message'); - const lastInView = Array.from(childElements).reverse().find((el) => { - return inView(parentElement, el); - }); + const lastInView = Array.from(childElements) + .reverse() + .find((el) => { + return inView(parentElement, el); + }); return lastInView; } @@ -50,14 +52,14 @@ }); function handleKeydown(event) { - if (event.key === 'Escape') { + if (event.key === 'Escape') { setLastRead(); // TODO: pass in "last message DT"? } } let lastReadCallback = null; function handleScroll() { - clearTimeout(lastReadCallback); // Fine if lastReadCallback is null still. + clearTimeout(lastReadCallback); // Fine if lastReadCallback is null still. lastReadCallback = setTimeout(setLastRead, 2 * 1000); } </script> |
